/**
 * Created by aaa on 2017/8/3.
 */
exports.info = function*(ctx) {
    ctx.body = {
        //获取url中参数 http://127.0.0.1:7001/user/1  html打印为 {"name":"hello 1"}
        name:`hello ${ctx.params.id}`,
    };
};

exports.index = function* (ctx) {
    ctx.body = yield ctx.model.User.find({});  // you should use upper case to access mongoose model
}

exports.save = function* (ctx) {
   const user= new ctx.model.User({
       userName:'yangzhiyuan',
        password:'123'
    });
    yield user.save();
    this.ctx.body=user
}